package terra.model;

import org.newdawn.slick.Graphics;

import terra.model.visual.AbstractVisualizator;

public class GameObject {
	
	public static enum ObjectType {
		ITEM,FLORA,LIGHT,NPC,PLAYER,ARROW,DOOR;
	}
	
	private int w = 0,h = 0;
	private float x = 0,y = 0;
	private int id;
	private int objectId;
	private int objectMoveNum = Integer.MIN_VALUE;
	private boolean left = true;
	private ObjectType type;
	private int level = 1;
	private float heading;
	AbstractVisualizator render;
	private byte animationCurrent = 0;
	private byte animationOld = 0;
	
	public int getW() {
		return w;
	}
	public void setW(int w) {
		this.w = w;
	}
	public int getH() {
		return h;
	}
	public void setH(int h) {
		this.h = h;
	}
	public float getX() {
		return x;
	}
	public void setX(float x) {
		this.x = x;
	}
	public float getY() {
		return y;
	}
	public void setY(float y) {
		this.y = y;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getObjectId() {
		return objectId;
	}
	public void setObjectId(int objectId) {
		this.objectId = objectId;
	}
	public void setXY(float x2, float y2) {
		setX(x2);
		setY(y2);
	}
	public ObjectType getType() {
		return type;
	}
	public void setType(ObjectType type) {
		this.type = type;
	}
	public int getObjectMoveNum() {
		return objectMoveNum;
	}
	public void setObjectMoveNum(int objectMoveNum) {
		this.objectMoveNum = objectMoveNum;
	}
	public boolean isLeft() {
		return left;
	}
	public void setLeft(boolean left) {
		this.left = left;
	}
	public int getLevel() {
		return level;
	}
	public void setLevel(int level) {
		this.level = level;
	}
	
	public void update(int delta){
		
	}
	
	public void render(Graphics g){
		
	}	
	
	public void attackAnimation() {
		// TODO attackAnimation
		
	}
	
	public void initRender(){
//		StaticImageVisualizator render = new StaticImageVisualizator();
//		render.renderName = DefManager.
//		render.render = ResourceManager.getImage(getImage());
//		render.render2 = ResourceManager.getImage(getImage()).getFlippedCopy(true, false);
//		render.blend = true;
//		render.setSize(Config.tileSize, Config.tileSize);
//		setDefaultRender(render);
	}
	
	public float getHeading() {
		return heading;
	}
	public void setHeading(float heading) {
		this.heading = heading;
	}
	public byte getAnimationCurrent() {
		return animationCurrent;
	}
	public void setAnimationCurrent(byte animationCurrent) {
		synchronized(this){
			setAnimationOld(getAnimationCurrent());
			this.animationCurrent = animationCurrent;
		}
	}
	public byte getAnimationOld() {
		return animationOld;
	}
	public void setAnimationOld(byte animationOld) {
		synchronized(this){
			this.animationOld = animationOld;
		}
	}
}
